﻿'use strict';

define([
    'backbone',
    'backgrid',
    'datepicker',
], function (Backbone, Backgrid) {
    //App config.
    var appConfig = {
        assetsFolderUrl: 'assets',
        commonViewsFolderUrl: 'common/views',
        databases: {
            billing: 'BillingDb',
        },
        defRoute: 'facturacion',
        formats: {
            date: 'DD/MM/YYYY',
            datepicker_date: 'dd/mm/yyyy',
            datetimedb: 'YYYY-MM-DD HH:mm:ss.SSS',
        },
        title: 'Sistema de Gestión',
        root: 'index.html/',
        routes: {
            'deudores': 'debtors',
            'facturacion(/:id)': {
                name: 'billing',
                parse: function (routedArgs) { return (routedArgs) ? { id: routedArgs[0], } : null; },
            },
            'historial': 'billingHistory',
            'clientes': 'customers',
            'productos': 'products',
        },
        screensFolderUrl: 'screens',
        websitePort: 181,
    };


    //Override Backgrid defaults.
    _.extend(Backgrid.NumberFormatter.prototype.defaults, {
        decimalSeparator: ',',
        orderSeparator: '.',
    });
    _.extend(Backgrid.NumberCell.prototype, {
            decimalSeparator: ',',
            orderSeparator: '.',
    });
    

    //Override datepicker defaults.
    _.extend($.fn.datepicker.defaults, {
        autoclose: true,
        format: appConfig.formats.datepicker_date, //Spanish
        orientation: 'bottom left',
    });

    return appConfig;
});